# app/models/family/blog.py
from tortoise import fields
from app.models.base.base import BaseModel

class Blog(BaseModel):
    """博客管理模型"""
    title = fields.CharField(max_length=200, description="博客标题")
    type = fields.CharField(max_length=20, description="博客类型")  # tech, travel
    status = fields.CharField(max_length=20, description="发布状态")  # draft, published, archived
    summary = fields.TextField(null=True, description="博客摘要")
    content = fields.TextField(description="博客内容")
    tags = fields.TextField(null=True, description="标签")
    cover_image = fields.CharField(max_length=255, null=True, description="封面图片URL")
    views = fields.IntField(default=0, description="浏览量")
    likes = fields.IntField(default=0, description="点赞数")
    comments = fields.IntField(default=0, description="评论数")
    
    # 关联字段
    user = fields.ForeignKeyField('models.User', related_name='blogs')
    
    class Meta:
        table = "blogs"
        table_description = "博客管理表"